package com.open.capacity.exam.controller;

import com.open.capacity.common.model.ExamQuestionsType;
import com.open.capacity.common.web.PageResult;
import com.open.capacity.common.web.Result;
import com.open.capacity.exam.service.QuestionTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/questionType")
@Api(tags = "考题类型管理")
public class QuestionTypeController {
    @Autowired
    private QuestionTypeService typeService;

    /**
     * 查询考题类型
     * @param param
     * @return
     */
    @GetMapping("/findAll")
    @ApiOperation(value = "条件查询考题类型")
    public PageResult<ExamQuestionsType> findAll(@RequestParam Map<String,Object> param){
        return typeService.findAll(param);
    }
    @PostMapping("/add")
    @ApiOperation(value = "添加考题类型")
    public Result addType(@RequestBody ExamQuestionsType type){
        return typeService.addType(type);
    }
    @PostMapping("/edit")
    @ApiOperation(value = "考题类型修改")
    public Result editType(@RequestBody ExamQuestionsType type){
        return typeService.editType(type);
    }
}
